#!/usr/bin/env python3
# -*- coding=utf-8 -*-

import os
from threading import Thread
import threadpool


class MultiThreading(object):
    @staticmethod
    def run(cmd):
        os.system(str(cmd))

    @staticmethod
    def multi_exec(cmd_list):
        tp = threadpool.ThreadPool(5)
        requests = threadpool.makeRequests(MultiThreading.run, cmd_list)
        [tp.putRequest(req) for req in requests]
        tp.wait()

if __name__ == '__main__':
    mul = MultiThreading()
    mul.multi_exec(["dir"])
